Skip to content

Ensure if-dependency edges don't pull in unselected tasks during target phase#917

Open
ahal wants to merge 1 commit intotaskcluster:mainfrom
ahal:ahal/push-xnxwptstknpm
Open

Ensure if-dependency edges don't pull in unselected tasks during target phase#917
ahal wants to merge 1 commit intotaskcluster:mainfrom
ahal:ahal/push-xnxwptstknpm

Conversation

@ahal
Copy link
Collaborator

@ahal ahal commented Mar 6, 2026

No description provided.

@ahal ahal self-assigned this Mar 6, 2026
@ahal ahal force-pushed the ahal/push-xnxwptstknpm branch 2 times, most recently from 4ff66be to a28e1c2 Compare March 11, 2026 14:46
@ahal ahal changed the title WIP: apply if-dependencies at target phase Ensure if-dependency edges don't pull in unselected tasks during target phase Mar 11, 2026
@ahal ahal marked this pull request as ready for review March 11, 2026 14:47
@ahal ahal requested a review from a team as a code owner March 11, 2026 14:47
@ahal ahal requested a review from bhearsum March 11, 2026 14:47
@Eijebong
Copy link
Contributor

Does this fix #710 ?

@ahal
Copy link
Collaborator Author

ahal commented Mar 11, 2026

Yes! Forgot about that.. I'll add it to the commit message

BREAKING CHANGE: Tasks will no longer pull `if-dependencies` in at the
target phase.

It's now possible for a task with multiple `if-dependencies` to run
after one task, without also causing the other to run.

Bug: 2020718
Issue: taskcluster#710
@ahal ahal force-pushed the ahal/push-xnxwptstknpm branch from a28e1c2 to 5f87817 Compare March 11, 2026 16:45
@ahal
Copy link
Collaborator Author

ahal commented Mar 11, 2026

Hm, though it would only impact the if-dependencies.. Should we use the same logic for soft-dependencies?

I think I'd want to do it in a follow-up as there is some time pressure to fixing this for if-dependencies. The bug is currently causing some havoc in Gecko.

Copy link
Contributor

@Eijebong Eijebong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is slightly wrong? If a task is both an if-dep for one task and a hard dep for another, the if-dep edge gets dropped.

def test_if_deps_bork(maketgg):
    tgg = maketgg(
        target_tasks=["u-t-0", "v-t-0"],
        kinds=[
            ("base", {}),
            (
                "v",
                {
                    "task-defaults": {
                        "dependencies": {"base": "base-t-0"},
                    }
                },
            ),
            (
                "u",
                {
                    "task-defaults": {
                        "dependencies": {"if-dep": "base-t-0"},
                        "if-dependencies": ["base-t-0"],
                    }
                },
            ),
        ],
    )

    target_graph = tgg.target_task_graph

    assert "u-t-0" in target_graph.tasks
    assert "v-t-0" in target_graph.tasks
    assert "base-t-0" in target_graph.tasks

    edges = target_graph.graph.edges
    assert ("u-t-0", "base-t-0", "if-dep") in edges

@jcristau
Copy link
Contributor

I worry a bit about unintended consequences here, for tasks that might expect that if they're running then all their dependencies have also run, not just one of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants